import { add } from "ol/coordinate";

export default class LayerManage {
	constructor(ol) {
		this.ol = ol;
		this.layers = [];
	}
	init(layer) {
		this.ol.setLayers(layer);
	}
	add(id, layer) {
		this.ol.addLayer(layer);
	}
	// get(id) {
	// 	return this.layers.find((layer) => layer.get("id") == id);
	// }
	showLayer(id) {
		let layersGroup = this.ol.getAllLayers();
		layersGroup.forEach((v, i) => {
			v.setVisible(v.get("pId") === id);
		});
	}
}
